package com.excesys.exsecs.access.util;

import lombok.experimental.UtilityClass;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * @author Administrator
 * @title: JsonUtil
 * @projectName pig
 * @description: TODO
 * @date 2023/5/1611:47
 */
@UtilityClass
public class JsonUtil {

	public static String convertStreamToString(InputStream inputStream) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
		StringBuilder sb = new StringBuilder();

		String line = null;
		try {
			while ((line = reader.readLine()) != null) {
				sb.append(line);
			}
		}
		catch (IOException e) {

			e.printStackTrace();
		}
		finally {
			try {
				inputStream.close();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
		}

		return sb.toString();
	}

	public static String addStrByCout(String input, int count) {
		StringBuffer fc = new StringBuffer();
		for (int i = 0; i < count; i++) {
			fc.append(input);
		}
		return fc.toString();
	}

}
